package com.ruoyi.cms.type.controller;

import com.ruoyi.cms.type.domain.CmsType;
import com.ruoyi.cms.type.service.ICmsTypeService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.service.SysPermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Set;

@RestController
@RequestMapping("/dy/life/type")
public class DyLifeController extends BaseController
{
    @Autowired
    private ICmsTypeService cmsTypeService;

    @Autowired
    private SysPermissionService permissionService;

    /**
     * 首页
     */
    @GetMapping("/list")
    public TableDataInfo list(CmsType cmsType)
    {
        startPage();
        List<CmsType> list = cmsTypeService.selectTopTypeList(cmsType);
        return getDataTable(list);
    }
    /**
     * 获取分类管理详细信息
     */
    @GetMapping(value = "/{typeId}")
    public AjaxResult getInfo(@PathVariable("typeId") Long typeId)
    {
        return AjaxResult.success(cmsTypeService.selectCmsTypeByTypeId(typeId));
    }
}
